<template>
  <van-sticky>
    <van-nav-bar left-arrow @click-left="onClickLeft">
      <ul class="serch-ul" slot="title">
        <li id="selfselect" :class="{active:tardeNumshow==0}" @click="tardeNumset(0)">自选</li>
        <li :class="{active:tardeNumshow==1}" @click="tardeNumset(1)">价格</li>
      </ul>
      <a :href="'tel:'+phoneNum" slot="right">
        <van-icon :name="phone" />
      </a>
    </van-nav-bar>
  </van-sticky>
</template>

<script>
import phone from "../../assets/img/phone.png";
export default {
  props: ["tardeNum"],
  data() {
    return {
      phone,
      phoneNum: this.$store.state.nocaches.kefuphone
    };
  },
  computed: {
    tardeNumshow() {
      return this.tardeNum;
    }
  },
  methods: {
    onClickLeft() {
      this.$router.go(-1);
    },
    tardeNumset(i) {
      if (i == 0 && this.$store.state.nocaches.notMemberobj.notMember) {
        this.$store.commit("munotMember", {
          notMember: true, //是否是该频道会员
          notMembershow: true
        });
        return false;
      }
      let islogin = this.$store.state.islogin;
      if (!islogin) {
        this.$store.commit("muloginmoduleshow", true);
        return false;
      }
      this.$emit("showbar", i);
    }
  }
};
</script>

<style scoped lang="less">
.van-nav-bar {
  background: #ffffff;
  .van-icon {
    color: #272937;
    font-size: 20px;
  }
  .van-nav-bar__text {
    color: #272937;
  }
}
.serch-ul {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  align-items: center;

  li {
    width: 49%;
    height: 100%;
    font-size: 0.3rem;
    color: rgba(110, 111, 117, 1);
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    &.active {
      font-weight: 500;
      color: rgba(228, 152, 41, 1);
      &::after {
        position: absolute;
        content: "";
        display: block;
        width: 0.32rem;
        height: 0.08rem;
        background: rgba(228, 157, 53, 1);
        border-radius: 0.05rem;
        bottom: 0;
        left: 50%;
        margin-left: -.16rem;

      }
    }
  }
}
</style>
